class Solution {
public:
    vector<string> findRelativeRanks(vector<int>& score) {
        int n = score.size();
        vector<string> res(n);
        if (n == 0) {
            return res;
        }
        //将score的下标和内容插入到tmp中
        vector<pair<int, int>> tmp;
        for (int i = 0; i < n; i++) {
            tmp.push_back(make_pair(score[i], i));
        }
        //将tmp进行降序排序
        sort(tmp.rbegin(), tmp.rend());
        //设置金银铜牌即前三名
        res[tmp[0].second] = "Gold Medal";
        if (n > 1) {
            res[tmp[1].second] = "Silver Medal";
        }
        if (n > 2) {
            res[tmp[2].second] = "Bronze Medal";
        }
        //从第四名开始设置
        for (int i = 3; i < n; i++) {
            res[tmp[i].second] = std::to_string(i + 1);
        }
        return res;
    }
};